package com.zyz.M_File和IO流.IO流.转换流;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author: vick
 * @Date: 2025/4/10
 * @Description:
 * @version: 1.0
 */
public class Demo3 {
    public static void main(String[] args) throws IOException {
        File file = new File("C:\\Users\\14338\\Desktop\\file.txt");
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        //创建转换流，默认使用UTF8编码
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "GBK");
        outputStreamWriter.write("你好");
        outputStreamWriter.close();
    }
}
